/**
 * 
 */
package valverde.nacho.stripes;

import java.util.Calendar;
import java.util.Date;

import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.Resolution;

/**
 * @author ignacio.canon@entelgy.com
 */
public class HelloActionBean extends MyActionBeanBase {
    private static final String VIEW = "/WEB-INF/jsp/hello.jsp";
    private Date date;

    /**
     * @return
     */
    @DefaultHandler
    public Resolution currentDate() {
	date = new Date();
	return new ForwardResolution(VIEW);
    }

    /**
     * @return
     */
    public Resolution previousDay() {
	Calendar cal = Calendar.getInstance();
	cal.add(Calendar.DAY_OF_MONTH, -1);
	date = cal.getTime();
	return new ForwardResolution(VIEW);
    }

    /**
     * getter para el campo date
     * 
     * @return date
     */
    public final Date getDate() {
	return date;
    }

    /**
     * @param date
     *            establece el valor de date
     */
    public final void setDate(Date date) {
	this.date = date;
    }

}
